<?php
header('content-type:text/html;charset=utf8');
$id=$_POST['id'];
$cname=isset($_POST['cname'])?$_POST['cname']:'';
$describe=$_POST['describe'];
$status=$_POST['status'];
$datetime=$_POST['datetime'];

$link =@mysql_connect('127.0.0.1','root','root');
if(!$link){
    die('连接失败，错误号为：'.mysql_errno().'失败原因：'.mysql_error());
}
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "update `column` set `cname`='$cname',`describe`='$describe',`status`='$status',`datetime`='$datetime' where `id`='$id'";
$res = mysql_query($sql);

if($res){
    echo '<script>alert("修改成功");window.location.href="/admin/column/index.php"</script>';
}else{
    echo '<script>alert("修改失败");window.location.href="/admin/column/index.php"</script>';
}
mysql_close();
?>